<?php
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
 
jimport('joomla.application.component.modellist');
jimport('joomla.application.component.helper');

/**
 * Tasks Model
 */
class MariagePlannerModelTasks extends JModelList
{	
	protected function getListQuery()
	{		
		$db			= $this->getDbo();
		$query		= $db->getQuery(true);
		
		$query->select('*');
		$query->from('#__mariageplanner_tasks');
		$query->order('`date` ASC');
		$query->where('planner_id=' . (int)$this->getState('planner.id', 0));
		
		return $query;
	}

	public function getItems()
	{
		$items	= parent::getItems();
		return $items;
	}
	
	/**
	 * Method to auto-populate the model state.
	 *
	 * Note. Calling getState in this method will result in recursion.
	 *
	 * @since	1.6
	 */
	protected function populateState()
	{
		$app = JFactory::getApplication();
	
		$pk =_getDefaultPlannerId($this->getDbo());
		$this->setState('planner.id', $pk);

		// Load the parameters.
		$params = $app->getParams();
		$this->setState('params', $params);
		
		parent::populateState();
	}
}
?>